#ifndef DOUBAN_MINIBLOG_RECOMMENDSUBVIEWER_H
#define DOUBAN_MINIBLOG_RECOMMENDSUBVIEWER_H

//#include "ui_RecommendSubViewer.h"
#include <QButtonGroup>
#include <QPushButton>
#include <QTextEdit>
#include <QLineEdit>
#include <QMovie>
#include <QLabel>

class QNetworkReply;

namespace Douban
{
	class DoubanContext;
	class MiniBlogEntry;
	class RecommendSubViewer : public QFrame
	{
		Q_OBJECT
		public:
			RecommendSubViewer(DoubanContext* c);
			~RecommendSubViewer();

			void cleanup();
			void viewEntry(MiniBlogEntry* );
			void updateView();
		protected:
			void closeEvent(QCloseEvent* );
		private:
//			Ui::RecommendSubViewer ui;
			QPushButton		recommendBtn;
			QPushButton		collectBtn;
			QWidget			ratingWidget;
			QPushButton		rate1Btn;
			QPushButton		rate2Btn;
			QPushButton		rate3Btn;
			QPushButton		rate4Btn;
			QPushButton		rate5Btn;
			QLabel			hintLabel;
			QPushButton		wishBtn;
			QPushButton		privateBtn;
			QPushButton		goingBtn;
			QPushButton		doneBtn;
			QTextEdit		contentText;
			QLineEdit		titleText;

			DoubanContext*	m_context;
			MiniBlogEntry*	m_currentEntry;

			QLabel		m_loadingLabel;
			QMovie		m_loadingMovie;

			QButtonGroup m_btnGroup;
			QButtonGroup m_ratingBtnGroup;

			QNetworkReply* r_collectReply;
			QNetworkReply* r_recommendReply;

			int i_rating;
			bool b_collected;
		private:
			void showLoading();
			void hideLoading();
		private slots:
			void setRating(int);
			void updateButton();

			void doCollect();
			void doRecommend();

			void onRecommended();
			void onCollected();
		private:
			static const QString Collect_URL;
			static const QString Collect_Entry;
			static const QString Recommendation_URL;
			static const QString Recommend_Entry;
	};
}
#endif // RECOMMENDSUBVIEWER_H
